
#ifndef SB_H
#define SB_H
#include "peripheral/impTypes.h"
#include "peripheral/bhm.h"
#include "peripheral/ppm.h"
#include <stdio.h>
#include <stdlib.h>

#define LOG(_FMT, ...)  bhmPrintf( "SIMULINK BRIDGE: " _FMT,  ## __VA_ARGS__)

typedef struct {
	int time;
	unsigned int sensor1;
} TimingParameter;

typedef struct {
	int count;
	int length;
	TimingParameter **timingparameters;
} TimingParameterList;

TimingParameterList *newTimingParameterList();
TimingParameter *newTimingParameter(TimingParameterList *tl);
void readTimingParameters(TimingParameterList *tl, char* filename);
void printTimingParameterList(TimingParameterList *tl);

TimingParameterList *tl;
int paramPosition;

extern Uns32 diagnosticLevel;

typedef struct SBCSP_ab32_dataS { 
    union { 
        Uns32 value;
    } sbData;
} SBCSP_ab32_dataT, *SBCSP_ab32_dataTP;

extern SBCSP_ab32_dataT SBCSP_ab32_data;


///////////////////////////////// Port handles /////////////////////////////////
typedef struct handlesS {
	void            *SBCSP;
	ppmNetHandle	timep;
	ppmNetHandle	valuep;	
} handlesT, *handlesTP;

extern handlesT handles;

PPM_REG_READ_CB(regRd32);
PPM_CONSTRUCTOR_CB(periphConstructor);
PPM_CONSTRUCTOR_CB(constructor);
PPM_DESTRUCTOR_CB(destructor);


#endif
